/*
 * Filename:    IdFactory.java
 * Copyright:   2014 中国平安保险（集团）股份有限公司 版权所有
 * Company:     平安科技养老险及健康险系统开发部
 * Create at:   2014年10月10日
 */
package com.paic.mhis.hcpms.quota.calculationreport.calculationjob.biz.service.impl;

import java.text.DecimalFormat;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.paic.mhis.hcpms.quota.calculationreport.calculationjob.biz.service.IdGenerator;
import com.paic.mhis.hcpms.quota.calculationreport.calculationjob.intergration.dao.KpiBatchDao;

@Component("idFactory")
public class IdFactory implements IdGenerator {
	public static final String pattern = "0000000";
	@Autowired
	private KpiBatchDao kpiBatchDao;

	@Override
	public String getId() {

		long id = this.kpiBatchDao.queryBatchNoSequence();
		DecimalFormat df = new DecimalFormat(pattern);

		return df.format(id);
	}

}
